/*
 * Copyright (c) 2020 Fraunhofer FOKUS and others. All rights reserved.
 *
 * See the NOTICE file(s) distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contact: mosaic@fokus.fraunhofer.de
 */

package org.eclipse.mosaic.fed.mqtt.constants;

public enum MqttTopic {

    SIMPLE("simple"),
    VEHICLE_MOVE("vehicleMove"),
    MEC("rpub/rcu/objs1/#");

    String topic;

    public static final String ALL = "#";
    public static final String ALL_PLACEHOLDER = "%s";

    MqttTopic(String topic) {
        this.topic = topic;
    }

    public String getTopic() {
        return topic;
    }

    public String getTopic(String... paras) {
        String t = topic.replaceAll(ALL, ALL_PLACEHOLDER);
        return String.format(t, paras);
    }
}
